<form class="form-horizontal form-modal" method="post" enctype="multipart/form-data" id="editForm">
    <input type="radio" name="myradio" value="random_name" hidden checked=true/>

    <input type="radio" name="myradio" value="random_name" hidden checked=true/>

    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">编辑首页装修</h4>
            </div>

            <div class="modal-body">
                <div class="row">
                    <div class="col-lg-12">

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">定位 ：</label>
                            <div class="col-sm-10">
                                <select class="chosen-select" name="position" onchange="operate(this.value)">
                                    <option value="index_banner" {if $info->position == 'index_banner'} selected{/if}>首页轮播图</option>
                                    <option value="index_video" {if $info->position == 'index_video'} selected{/if}>首页视频</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <div id="image">
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">图片 ：</label>
                                <div class="col-sm-10">
                                    <img src="{empty name='$info->image'}
                                                    {__ADMIN__}/dist/img/default-img.png
                                               {else/}
                                                    {$info->image}
                                               {/empty}
                                              "
                                         alt="" class="upload-file-alone">
                                    <div class="custom-file">
                                        <input type="file" name="index_banner" class="custom-file-input" onchange="custom_file_input($(this))">
                                        <span class="custom-file-label">
                                            选择文件
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div >


                        <div id="video1"  style="display: none;">
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">视频文件列表 ：</label>
                                <div class="col-sm-10" id="ossfile"></div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div id="video2"  style="display: none;">
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">视频地址 ：</label>
                                <div class="col-sm-10">
                                    <input type="text" name="video" class="form-control" value="{$info->video}" id="index_video" readonly>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>

                        <div id="video" style="display: none;">
                            <div class="form-group row">
                                <label class="col-sm-2 col-form-label">视频上传 ：</label>
                                <div class="col-sm-10">
                                    <div id="container">
                                        <a id="selectfiles" href="javascript:void(0);" class='btn'>选择文件</a>
                                        <a id="postfiles" href="javascript:void(0);" class='btn'>开始上传</a>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>



                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">排序 ：</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" name="sort" value="{$info->sort}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group row">
                            <label class="col-sm-2 col-form-label">状态 ：</label>
                            <div class="col-sm-10">
                                <label class="lab-radio">
                                    <input type="radio" value="1" name="status" {if $info->status == 1} checked {/if}>显示
                                </label>
                                <label class="lab-radio">
                                    <input type="radio" value="0" name="status" {if $info->status == 0} checked {/if}>隐藏
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="post_form($(this),'{$Think.config.admin.app_host}/admin/renovation/{$info->id}')">保存
                </button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" src="{__ADMIN__}/js/plugins/plupload-2.1.2/js/plupload.full.min.js"></script>
<script type="text/javascript" src="{__ADMIN__}/js/upload.js"></script>

<script>
    $(function () {
        $('.chosen-select').chosen({width: "100%", search_contains: true,});
        operate('{$info->position}');
    })

    function operate(status) {

        if(status == 'index_banner'){
            $('#image').show();
            $('#video').hide();
            $('#video1').hide();
            $('#video2').hide();
        }

        if(status == 'index_video'){
            $('#image').hide();
            $('#video').show();
            $('#video1').show();
            $('#video2').show();
        }
    }

</script>
